<?php

namespace app\teacher\controller\organization;

use app\common\controller\Frontend;
use app\common\model\banxi\organization\Organization as OrganizationModel;

class Organization extends Frontend
{
    protected array $noNeedLogin = [];

    protected array $noNeedPermission = ['*'];

    public function initialize(): void
    {
        parent::initialize();
    }

    /*
     * 教练相关机构
     */
    public function listMySelectOrganization()
    {
        $params = $this->request->post(['index' => 1, 'limit' => 10, 'query', 'searchText']);
        if (!empty($params['searchText'])) {
            $params['query']['LIKE_name'] = $params['searchText'];
        }
        $organizationId = $this->auth->organizationId;
        $params['query']['IN_id'] = $organizationId;
        $where = get_query($params);
        $pageParams = get_page_params($params);
        $organizationModel = new OrganizationModel();
        $list = $organizationModel->getListSelectPage($where, $pageParams['page'], $pageParams['limit']);
        $this->ok('操作成功', $list);

    }
}